package day11;

import java.util.Iterator;
import java.util.LinkedList;

public class LinkedListDemo {
    public static void main(String[] args) {
        LinkedList<String> list=new LinkedList<>();
        list.add("java");
        list.add("qwe");
        list.add("we");
         list.addLast("oring");
        System.out.println(list.getLast());
        //将元素添加到链表表头
        list.addFirst("or");
        System.out.println(list.remove());
        System.out.println(list.removeFirst());
//        System.out.println(list.offerFirst("ae"));
     //   System.out.println(list.getFirst());
     //   System.out.println(list.peekFirst());
        System.out.println("====");
        Iterator<String> iter=list.iterator();
            while (iter.hasNext()){
                System.out.println(iter.next());
            }



    }
}
